   <#include
"../common/com.html"/> <@layout>
   	
<!-- ace styles -->
<link rel="stylesheet" href="${ctx}/static/assets/css/ace.min.css" />

<script type="text/javascript">
    /**
     * 新增
     */
    function saveModel() {
        var id=document.getElementById("id").value;
        if(Validator.Validate(document.getElementById('form1'))){
        } else {
            return;
        }
        
        url = '';
        if(id==""){
            url = '${ctx}/tbMeet/save';
        }     else{
            url = '${ctx}/tbMeet/update';
        }
        $('#form1').form('submit', {
            url : url,
            onSubmit : function() {
                return $(this).form('validate');
            },
            success : function(data) {
                alert(data);
                parent.location.reload();
                //window.location.href=' ${ctx}/tbMeet';
            }
        });

    }
</script>
<div class="page-content">
<div class="row-fluid">
						<div class="span12">
                <form class="form-horizontal"  id="form1" method="post" >
                	<input type="hidden"  name="id" id="id"    >
								 								<div class="control-group">
									<label class="control-label">会议名称:</label>
						<div class="controls"> <input id="title"
								name="title" type="text" dataType="Require" msg="请填写会议名称" 
								  style="min-height: 24px;"  />
							</div>
								 	</div>
						<div class="control-group">
									<label class="control-label">会议类型:</label>
						<div class="controls"> 
						<input id="type_val" type="hidden" /> 
						<select name="type" id="type" panelheight="100" dataType="Require" msg="请选择会议类型" >
                         </select>
						</div>
								 	</div>
								 	
						<div class="control-group">
									<label class="control-label">老师:</label>
						<div class="controls"> 
						<input id="teacherid_val" type="hidden" class="easyui-numberbox"/> 
						
						<select id="teacherid" name="teacherid" name="type" id="type" panelheight="80" 
							style="width: 205px;" dataType="Require" msg="请选择老师" >
                        </select>
						</div>
						</div>
						
						<div class="control-group">
									<label class="control-label">指导价:</label>
						<div class="controls"> <input id="feemeet"
								name="feemeet" type="text" dataType="Number" msg="指导价必须为数字" 
								  style="min-height: 24px;"  />
							</div>
						</div>
		
             </form>
        </div>
        	<div class="span12 center">
				<a  class="btn btn-info btn-small" onclick="saveModel()">确定
				<a href="#"  class="btn btn-danger btn-small bigger-110"  onclick="parent.closeDialog();"  >取消 </a>
		</div>
    </div>
</div>

    </body>
   
    <script>
    /**
    * 修改页面使用
    */
    <#list newlist as m>
	document.getElementById("id").value  
	=  '${(m.id)!}';
    document.getElementById("title").value  
    =  '${(m.title)!}';
    document.getElementById("feemeet").value  
    =  '${(m.feemeet)!}';
    
    $("#type_val").val('${(m.type)!}');
    $("#teacherid_val").val('${(m.teacherid)!}');
	</#list>
		
	$(function(){
		// 会议类型初始化
		var kygl_url = "${ctx}/common/comboTree/type='hylx'?table=codes&fields=code as id,name as text&pid=pid&pidStart=0&id=id";
		$.ajax({
		    url:kygl_url,
			data : "",
			success : function success(data) {
				$.each(data,function(key, val) {
					if(data[key].id=="0"){
						$("#type").append("<option  value=''>请选择会议类型</option>");
					}else{
						$("#type").append("<option  value='"+data[key].id+"'>" + data[key].text + "</option>");
					}
				});
				// 选择
				$("#type").val($("#type_val").val());
				
			},
			dataType : "json"
		});
		
	});
	
	//老师初始化
	var url = "${ctx}/tbMeetTeacher/queryAll";
	$.ajax({
	    url:url,
		data : "",
		success : function success(data) {
			$.each(data,function(key, val) {
				if(data[key].id=="0"){
					$("#teacherid").append("<option  value=''>请选择老师</option>");
				}else{
					$("#teacherid").append("<option  value='"+data[key].id+"'>" + data[key].text + "</option>");
				}
			});
			// 选择
			$("#teacherid").val($("#teacherid_val").val());
			
		},
		dataType : "json"
	});
	 	
    	 
    </script>
 </@layout> 
